<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var fib = function(n) {
    if(n==0){
        return 0
    }
    if(n==1){
        return 1
    }
    return fib(n-1) + fib(n-2)
};
// 传统写法没取模超时
var n = 5
console.log(fib(n))
    </script>
</body>
</html>